import Vue from 'vue'
import './plugins/axios'
import App from './App.vue'
import Router from "vue-router";
import router from "./router/index"; // 路由
import {beforeRouter} from "./router/index"; // 路由拦截


import store from './store'
// import 'babel-polyfill' // 解决ie兼容问题
import './plugins/iview.js'
import "./css/public.less"; // 公共css样式
// 工具
import {backPage, isNotNull, isBlank} from "./config/util";
Vue.prototype.$isNotNull = isNotNull
Vue.prototype.$isBlank = isBlank
// 解决跳转同一个路由报错
const originalPush = Router.prototype.push
Router.prototype.push = function push(location) {
  return originalPush.call(this, location).catch(err => err)
}
// 路由跳转前事件
router.beforeEach((to, from, next) => {
  beforeRouter(to, from, next)
})
// 路由切换 滚到到顶部
router.afterEach((to, from, next) => {
  window.scrollTo(0, 0);
  /*if(to.name !== loginPage){
    // 如果不是登录页 内容区域滚动到顶部
    Vue.nextTick(() => {
      document.getElementById('main_content').scrollTo(0, 0);
    })
  }*/
})
Vue.config.productionTip = false

new Vue({
  router,
  store,
  render: h => h(App)
}).$mount('#app')
